﻿using MediatR;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RearLivestock.Common.Domains.hq;
using RearLivestock.Common.Dtos;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.Ablactationss;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.Bedroomss;
using RearLivestock.RBAC.Api.Application.hqApplication.Commands.PigFarmss;

namespace RearLivestock.RBAC.Api.Controllers.hq
{
    /// <summary>
    /// 母猪断奶
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AblactationsController : ControllerBase
    {
        private readonly IMediator imediator;
        public AblactationsController(IMediator imediator)
        {
            this.imediator = imediator;
        }
        /// <summary>
        /// 断奶添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> addAblactations(AddAblactationsCommand cmd)
        {
            return await imediator.Send(cmd);
        }


        /// <summary>
        /// 断奶显示
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result<PageResultDto<Ablactations>>> showAblactations(ShowAblactationsCommand cmd)
        {
            return await imediator.Send(cmd);
        }
        /// <summary>
        /// 母猪断奶删除
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<Result> DeleteAblactation(DeleteAblactationCommand cmd)
        {
            return await imediator.Send(cmd);
        }
        /// <summary>
        /// 猪只断奶查询耳号
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetBasicInformation(GetAblactionsComand cmd)
        {
            return await imediator.Send(cmd);
        }
        /// <summary>
        /// 转舍
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetBrdRoom(GetBrdRoomComand cmd)
        {
            return await imediator.Send(cmd);
        }

        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetAddAblactations(FandAblactationsCommand cmd)
        {
            return await imediator.Send(cmd);
        }



        /// <summary>
        /// 母猪断奶修改
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<Result> UpdateAddAblactations(UpdateAblactationCommand cmd)
        {
            return await imediator.Send(cmd);
        }

    }
}
